package com.yz.android_baozou.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;

import com.yz.android_baozou.R;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MainPageDetailActivity extends AppCompatActivity {

    @Bind(R.id.webView_PageDetil)
    WebView webViewPageDetil;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_page_detail);
        ButterKnife.bind(this);
        //声明intent
        Intent intent = getIntent();
        //获得bundle对象
        Bundle bundle = intent.getBundleExtra("url");
        //获得传入的url地址
        String url = (String) bundle.get("url");
        //加载网络地址
        webViewPageDetil.loadUrl(url);
        //开启JavaScript支持
        webViewPageDetil.getSettings().setJavaScriptEnabled(true);
        //强制使用web view加载网页
        webViewPageDetil.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });

    }
}
